import request from '@/utils/request'

export function getList() {
  return request({
    method: 'get',
    url: '/company/department'
  })
}
export const getDepartments = getList
// 新增部门
export function addDept(data) {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}

// 根据id删除部门
export function delDept(id) {
  return request({
    method: 'delete',
    url: `/company/department/${id}`
  })
}

// 根据id查询详情 进行编辑
export function getDeptById(id) {
  return request({
    method: 'get',
    url: `/company/department/${id}`
  })
}

export function updateDept(data) {
  return request({
    method: 'put',
    url: `/company/department${data.id}`,
    data
  })
}
